﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Controls;
using BaseWordStat;
using DbLayer;

namespace WordStat
{
    public sealed class ArticleService
    {
        public TreeViewItem GetItem()
        {
            return new AllItemsViewItem();
        }

        public Dictionary<string, int> GetDataFrom(TreeViewItem selectedItem, int page, int itemOnPages, string source)
        {
            if (selectedItem is AllItemsViewItem)
            {
                var rootItem = (selectedItem as AllItemsViewItem);

                return DbProxy.GetAllWordsData(page, itemOnPages, source);
            }

            return null;
        }

        public IDictionary<Article, int> GetArticles(string wordText, string currentSource)
        {
            return DbProxy.GetArticles(wordText, currentSource);
        }
    }

    public sealed class AllItemsViewItem : TreeViewItem
    {
        public AllItemsViewItem()
        {
            Header = "Все статьи";
        }
    }
}
